using System;
using System.Collections.Generic;

namespace libcharakter
{
	namespace Talente
	{
		public enum TalentType
		{
			Kampf, //
			Koeperlich, //
			Gesellschaft, //
			Natur, //
			Wissen, //
			SpracheUndSchriften, //
			Handwerk, //
			Gaben, 

			MAX
		}
		[Serializable]
		public abstract class abTalent : Attribute
		{
			private TalentType m_type;

			public TalentType Type { get { return m_type; } }


			public abTalent (string name, int value,TalentType type, TableColum col, Charakter charakter)
				: base(name, (short)value, 0, col, false, charakter)
			{
				m_type = type;
			}
			public abstract bool Probe(Eigenschaften eg, int wert1, int wert2, int wert3,
			                           int erschwert, ref int rest);

			protected bool Probe (Attribute ab1, Attribute ab2, Attribute ab3, int wert1, int wert2, int wert3,
			                      int erschwert, ref int rest)
			{
				int temp = Value;
				int v1 = ab1.Value , v2 = ab2.Value, v3 = ab3.Value;

				if (temp <= 0) 
				{
					v1 -= erschwert;
					v2 -= erschwert;
					v3 -= erschwert;
				} 
				else 
				{
					temp -= erschwert;
				}
				int[] werte = new int[]
				{
					(v1 ) - wert1,
					(v2 ) - wert2,
					(v3 ) - wert3
				};
				foreach (int i in werte) 
				{
					temp += (i < 0) ? i : 0;
				}

				rest = temp;

				return (temp >= 0);
			}
		}
	}
}

